package niconama04.server;

import java.util.List;

import niconama04.client.CreateService;
import niconama04.model.impl.TransacterFactory;
import niconama04.shared.data.Category;
import niconama04.shared.data.Original;
import niconama04.shared.data.Sentence;
import niconama04.shared.data.Constants.Pos;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;


public class CreateServiceImpl extends RemoteServiceServlet implements CreateService {

	/** Serial Version */
	private static final long serialVersionUID = 4745218493756945894L;

	@Override
	public List<Original> getOriginals() throws Exception {
		return TransacterFactory.getInstance().getLoader().getOriginals(Pos.MEISHI);
	}

	@Override
	public List<Category> getCategorys() throws Exception {
		return TransacterFactory.getInstance().getLoader().getCategorys();
	}

	@Override
	public Sentence getSentenceByOriginal(Original x_original) throws Exception {
		return TransacterFactory.getInstance().getRandomLoader().createSentence(x_original);
	}

	@Override
	public Sentence getSentenceByCategory(Category x_category) throws Exception {
		return TransacterFactory.getInstance().getRandomLoader().createSentence(x_category);
	}
}
